The sample ListProvider in this example does the following:
The sample code demonstrates
The sample code provides functionality for requirements such as:
This sample code needs the following to run:
List Provider plugin (examples\interview-engine\list-provider in either Java or .NET runtime zip).
An SQL database - for example, Derby for Java or SQL Express for .NET. Refer to the db script in either of the runtime zips.
The rules are not relevant for this sample, it is the attributes that the List Provider needs to provide list options for
The attributes relevant to this example:
Global
AU_STATES |
---|
ID |
STATE_SHORTNAME |
STATE_FULLNAME |
POLITICAL_ALIGNMENTS |
---|
ID |
PA_NAME |
Copy the rulebase .zip file (ExtFrameworkListProvider.zip) from examples\rulebases\compiled to the rulebase folder in Web Determinations (for example, <webroot>\WEB-INF\classes\rulebases)
For the .NET version, ensure that SQL Server is running and the ASPNET user account has access to the database.
Note:
If you need to modify the database connection details or you need class files for your specific database implementation, then you will need to edit the source code, recompile and create the JAR or DLL.
The DerbyListProvider is always called when a List input control is displayed during the Web Determinations Interview. The DerbyListProvider allows the Web Determinations to use the default list items on the List input control (default list items - the list of values provided by the rule author) unless the Attribute associated to the List input control is 'states' or 'political_alignment'. The DerbyListProvider returns a 'null' object to let the Web Determinations know to use the default list items.
If the Attribute of the List input control is 'states' or 'political_alignment', DerbyListProvider accesses the DERBY database, access either the AU_STATES or POLITICAL_ALIGNMENTS table (depending on the Attribute), and gets the list items. It then constructs a List of ListOptions from the data retrieved. The DerbyListProvider returns the list of ListOptions, which tells Web Determinations that it should use this list as the items in the List input control instead of the default list.
To view the source code for the sample, refer to examples\interview-engine\derby-list-provider in the Java runtime zip file or examples\interview-engine\list-provider in the .NET runtime zip file.